<template>
  <div class="common-layout">
    <el-container>
      <el-header style="border-top:0%;padding-left:0%;">
		  人力资源管理->员工入职管理
	  </el-header>
      <el-main>
		  <p></p>
		  <el-form :model="employee" label-width="120px">
			  <el-form-item label="姓名:">
				  <el-input v-model="employee.eName" />
			  </el-form-item>
			  <el-form-item label="身份证号:">
			  	  <el-input v-model="employee.eIdentityCard" />
			  </el-form-item>
			  <el-form-item>
			      <el-button type="primary" @click="onSubmit">查询</el-button>
			  </el-form-item>
		  </el-form>
	  </el-main>
    </el-container>
  </div>
</template>

<script>
import qs from 'qs'
import {ElMessage} from 'element-plus'
export default{
		data(){
			return{
				employee:{}
			}
		},
		methods:{
			onSubmit(){
				let that=this
				let str=qs.stringify(that.employee)
				//axios
				this.$axios.get("http://localhost:8080/employee/selectebc?"+str).then(function(res){
					console.log(str)
					console.log(res)
					if(res.data!=null&&res.data!='')
					{
						that.$store.commit('oldEmploy',res.data.ename)
						that.employee.eId=res.data.eid
						let stru=qs.stringify(that.employee)
						that.$axios.get("http://localhost:8080/employee/updateefs?"+stru).then(function(resu){
							console.log(stru)
							if(resu!=0)
							{
								console.log("修改成功")
							}
							else
							{
								console.log("修改失败")
							}
						})
						that.$router.push("/humanres/tocompanyemploy")
					}
					else
					{
						that.$router.push("/humanres/tocompanysociety")
					}
				})
			},
			deleteRow(rIndex){
				//删除数组中的数据
				this.news.splice(rIndex,1)
			}
		}
	}
</script>

<style>
	.el-header{
		height:30px;
		text-align:left;
	}
</style>